<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h3>获取对象User的值</h3>
    user: <span th:text="${user}"></span> <br>
    id: <span th:text="${user.id}"></span> <br>
    name: <span th:text="${user.name}"></span>
    <hr>
    <h3>获取集合userList的值</h3>
    userList: <span th:text="${userList}"></span> <br>
    list[0]: <span th:text="${userList[0]}"></span> <br>
    list[1]: <span th:text="${userList[1]}"></span> <br>
    list[0].name: <span th:text="${userList[0].name}"></span>
    <hr>
    <h3>从userMap中获取值</h3>
    userMap: <span th:text="${userMap}"></span> <br>
    userMap['user']: <span th:text="${userMap.user}"></span> <br>
    userMap.user.name: <span th:text="${userMap.user.name}"></span> <br>
    <hr>
    <h3>if-unless测试</h3>
        <p th:if="${flag}"> 我是If=True标签</p>
        <p th:unless="${flag}"> 我是Unless 标签</p>
    <hr>
    <h3>分支结构用法</h3>
    <div th:switch="${level}">
        <p th:case="1">我是level1</p>
        <p th:case="2">我是level2</p>
        <p th:case="3">我是level3</p>
    </div>
    <hr>
    <h3>循环结构</h3>
    <div th:each="user,status:${userList}">
        序号: <span th:text="${status.count}"></span>
        索引: <span th:text="${status.index}"></span>
        id: <span th:text="${user.id}"></span>
        name: <span th:text="${user.name}"></span>
    </div>
</body>
</html>